<?php
namespace Application\Component;
use Doctrine\ORM\EntityManager;
use Application\Entity\Country;
use Application\Component\AbstractComponent;
/**
 * CountryServcie
 *
 */
class CountryComponent extends  AbstractComponent
{
    protected  $entity="Application\\Entity\\Country";

	function insert($country)
	{
		$this->em->persist($country);
		$this->em->flush();
	}
	
	
	function update($country)
	{
		$this->em->persist($country);
		$this->em->flush();
	}
	
	
	
	function getAll()
	{
		$country = $this->em->getRepository($this->entity)->findAll();
		return  $country;
	}
	
	
	
	function getByCode($code)
	{
		$country = $this->em->getRepository($this->entity)->getByCode($code);
		return  $country;
	}
}
